package com.onpositive.wiki2.whole.model;

import com.onpositive.wiki2.miner.CompositeVisitor;
import com.onpositive.wiki2.miner.Page;
import com.onpositive.wiki2.miner.WikiPediaPass;
import com.onpositive.wiki3.db.LocationProperties;

public class ContentPackager {

	
	public static void main(String[] args) {
		try {
			CompositeVisitor v = new CompositeVisitor();
			final RedirectStatingVisitor ll = new RedirectStatingVisitor();
			v.add(ll);
			String contentsPath = LocationProperties.getProperty(LocationProperties.LOCATION_CONTENTS_FOLDER);
			PageIndexer arg0 = new PageIndexer(contentsPath){
				
				int a=0;
				
				@Override
				protected void onPage(Page page) {
					super.onPage(page);							
					a++;
				}
			};
			ContentTable t=new ContentTable(contentsPath);
			v.add(arg0);
			v.add(t);
			try{
			WikiPediaPass.doPass(v);
			}catch (Exception e) {
				// TODO: handle exception
			}
			t.close();
			
			arg0.close();
		} catch (Exception e) {
			e.printStackTrace();
			// TODO: handle exception
		}
	}
}
